package com.idak.jax.ws.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.idak.jax.ws.model.User;
import com.idak.jax.ws.service.AuthentificationService;
import com.idak.jpa.service.UserService;

@Service()
public class AuthentificationServiceImpl implements AuthentificationService {

	@Autowired
	private UserService userService;
	
	@Override
	public boolean authenticate(User user) {
		
		boolean isAuthentified = false;
		
		if(user!= null){
			String login    = user.getLogin();
			String password = user.getPassword();
			isAuthentified  = userService.authenticateUserByLoginAndPassword(login, password);
		}
		
		return isAuthentified;
	}

}
